function kost = belasting_sector(sector,p_piek,tijd)
sector = char(sector);
%model:
% t0 = 0;
% t1 = 20*60;%20 min (interruption.pdf)
% t2 = 3600; %(interruption.pdf)
% t3 = 4*3600; %(interruption.pdf)
% t4 = 6*3600; %(determination and use of SCDF)
% t5 = 12*3600;  %(determination and use of SCDF)
% t6 = 24*3600;  %(determination and use of SCDF)

%c bepaalt eerste 20 min
%c = 1 : lineair
%c = 2 : exp
%c = 3 : log

% verschillende kostenprofielen
switch sector
    
 case 'voeding'
    
    %BILLINTON

    %%%%%%%%%%%%%%%%%%%%
    %VOEDING(INDUSTRIE)%
    %%%%%%%%%%%%%%%%%%%%
        c = 1;%variabele die de eerste 20 minuten bepalen
        k1 = 4.74;
        k2 = 15.1;
        k3 = 50.52;
        k4 = 70;
        k5 = 150;
        k6 = 270;
        k7 = 300; %verzonnen


  case 'textiel'
      
      %%%%%%%%%%%%%%%%%%%%
      %TEXTIEL(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
        c = 3;
        k1 = 3.02;
        k2 = 5.4;
        k3 = 7.45;
        k4 = 10;
        k5 = 20;
        k6 = 30;
        k7 = 35; %verzonnen
        
  case 'hout'
      
      %%%%%%%%%%%%%%%%%%%%
      %HOUT(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
       c = 3;
        k1 = 0.02;
        k2 = 0.12;
        k3 = 1.28;
        k4 = 10;
        k5 = 18;
        k6 = 20;
        k7 = 23; %verzonnen
      
  case 'papier'
      
      %%%%%%%%%%%%%%%%%%%%
      %PAPIER(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 4.79;
        k2 = 5.29;
        k3 = 12.71;
        k4 = 14;
        k5 = 18;
        k6 = 20;
        k7 = 23; %verzonnen
        
  case 'uitgeverij'
      c = 1;
      %%%%%%%%%%%%%%%%%%%%
      %UITGEVERIJ(INDUSTRIE) = TEXTGIEL%
      %%%%%%%%%%%%%%%%%%%%
      
        k1 = 3.02;
        k2 = 5.4;
        k3 = 7.45;
        k4 = 10;
        k5 = 20;
        k6 = 30;
        k7 = 35; %verzonnen
        
    case 'energie'
      
      %%%%%%%%%%%%%%%%%%%%
      %ENERGIE(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 81.47;
        k2 = 193.88;
        k3 = 205.85;
        k4 = 240;
        k5 = 250;
        k6 = 300;
        k7 = 330; %verzonnen
    
  
    case 'chemie'
      
      %%%%%%%%%%%%%%%%%%%%
      %CHEMIE(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 1.70;
        k2 = 3.27;
        k3 = 17.93;
        k4 = 40;
        k5 = 50;
        k6 = 60;
        k7 = 70; %verzonnen
        
    case 'rubber'
      
      %%%%%%%%%%%%%%%%%%%%
      %RUBBER(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 3;
        k1 = 0.78;
        k2 = 1.26;
        k3 = 4.52;
        k4 = 25;
        k5 = 30;
        k6 = 30;
        k7 = 31; %verzonnen
        
     case 'mineralen'
      
      %%%%%%%%%%%%%%%%%%%%
      %niet metaalhoudende mineralen(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 2.96;
        k2 = 3.27;
        k3 = 8.31;
        k4 = 25;
        k5 = 40;
        k6 = 60;
        k7 = 70; %verzonnen
        
     case 'metallurgie'
      
      %%%%%%%%%%%%%%%%%%%%
      %metallurgie(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 3;
        k1 = 1.55;
        k2 = 2.49;
        k3 = 5.26;
        k4 = 10;
        k5 = 20;
        k6 = 30;
        k7 = 35; %verzonnen
        
        
     case 'metaalverwerking'
      
      %%%%%%%%%%%%%%%%%%%%
      %metaalverwerking(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 4.57;
        k2 = 9.16;
        k3 = 42.07;
        k4 = 130;
        k5 = 155;
        k6 = 155;
        k7 = 155; %verzonnen
    
        case 'machinebouw'
      
      %%%%%%%%%%%%%%%%%%%%
      %machinebouw(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 3.02;
        k2 = 5.4;
        k3 = 18.45;
        k4 = 21;
        k5 = 25;
        k6 = 30;
        k7 = 35; %verzonnen
        
        case 'elektrische_apparaten'
      
      %%%%%%%%%%%%%%%%%%%%
      %elektrische_apparaten(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 3.48;
        k2 = 6.60;
        k3 = 19.89;
        k4 = 40;
        k5 = 50;
        k6 = 60;
        k7 = 70; %verzonnen
        
        case 'communicatieproducten'
      
      %%%%%%%%%%%%%%%%%%%%
      %communicatieproducten(INDUSTRIE) (=elektrische productie??)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 3.48;
        k2 = 6.60;
        k3 = 19.89;
        k4 = 40;
        k5 = 50;
        k6 = 60;
        k7 = 70; %verzonnen
        
        case 'automobiel'
      
      %%%%%%%%%%%%%%%%%%%%
      %automobiel(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 11.87;
        k2 = 35.92;
        k3 = 150;
        k4 = 250;
        k5 = 350;
        k6 = 400;
        k7 = 420; %verzonnen
        
        case 'overig_transport'
      
      %%%%%%%%%%%%%%%%%%%%
      %productie van overig transport(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 9.61;
        k2 = 23.67;
        k3 = 185.21;
        k4 = 250;
        k5 = 350;
        k6 = 400;
        k7 = 420; %verzonnen
        
        case 'elektriciteit_gas'
      
      %%%%%%%%%%%%%%%%%%%%
      %prod en distrib van elek en gas(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 3;
        k1 = 1.54;
        k2 = 11.32;
        k3 = 33.19;
        k4 = 45;
        k5 = 69;
        k6 = 120;
        k7 = 155; %verzonnen
        
        case 'water'
      
      %%%%%%%%%%%%%%%%%%%%
      %water distrib en winning(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 1.54;
        k2 = 11.32;
        k3 = 33.19;
        k4 = 45;
        k5 = 69;
        k6 = 120;
        k7 = 155; %verzonnen
        
        case 'vervoer_land'
      
      %%%%%%%%%%%%%%%%%%%%
      %vervoer_land(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 2;
        k1 = 24.16;
        k2 = 29.39;
        k3 = 58.49;
        k4 = 250;
        k5 = 400;
        k6 = 650;
        k7 = 680; %verzonnen
        
        case 'gezondheidszorg'
      
      %%%%%%%%%%%%%%%%%%%%
      %gezondheidszorg(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 2.38;
        k2 = 3.02;
        k3 = 4.38;
        k4 = 65;
        k5 = 120;
        k6 = 123;
        k7 = 150; %verzonnen
        
        case 'afval'
      
      %%%%%%%%%%%%%%%%%%%%
      %afval(INDUSTRIE) zoals energie?%
      %%%%%%%%%%%%%%%%%%%%
      c = 3;
        k1 = 1.70;
        k2 = 3.27;
        k3 = 17.93;
        k4 = 40;
        k5 = 50;
        k6 = 60;
        k7 = 70; %verzonnen
        
        case 'andere'
      
      %%%%%%%%%%%%%%%%%%%%
      %andere(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      c = 1;
        k1 = 4.26;
        k2 = 12.29;
        k3 = 50.43;
        k4 = 70;
        k5 = 150;
        k6 = 270;
        k7 = 300; %verzonnen
        
    case 'niet_metaal_delfstoffen'
        c = 1;
        %%%%%%%%%%%%%%%%%%%%
      %andere(INDUSTRIE)%
      %%%%%%%%%%%%%%%%%%%%
      
        k1 = 2.96;
        k2 = 3.74;
        k3 = 8.31;
        k4 = 12;
        k5 = 25;
        k6 = 35;
        k7 = 40; %verzonnen
        
        
        
    otherwise
    'ERROR : bestaat niet'
end
  
t0 = 0;
t1 = 20*60;%20 min (interruption.pdf)
t2 = 3600; %(interruption.pdf)
t3 = 4*3600; %(interruption.pdf)
t4 = 6*3600; %(determination and use of SCDF)
t5 = 12*3600;  %(determination and use of SCDF)
t6 = 24*36000;
k0 = 0;
t = [1200 3600 14400 21600 43200 t6];
p = [k1*(1+0.06)^7 k2*(1+0.06)^7 k3*(1+0.06)^7 k4*(1+0.06)^15 k5*(1+0.06)^15 k6*(1+0.06)^15];

if c==1 && tijd<t1
    
    kost_per_kW = interp1([t0 t1],[k0 k1],tijd)*(1+0.06)^7; %van 1999 naar 2006 met discontofactor van 6%;
    kost = kost_per_kW*p_piek;

elseif c==2 && tijd<t1
    
    t00 = 10;
    t01 = 100;
    t02 = 200;
    t03 = 300;
    t04 = 400;
    t05 = 500;
    t06 = 600;
    t07 = t1;
    
    k00 = k1/100;
    k01 = k1/20;
    k02 = k1/15;
    k03 = k1/10;
    k04 = k1/8;
    k05 = k1/7;
    k06 = k1/4;
    k07 = k1;
    
    kost_per_kW = interp1([t0 t00 t01 t02 t03 t04 t05 t06 t07],[k0 k00 k01 k02 k03 k04 k05 k06 k07],tijd)*(1+0.06)^7; %van 1999 naar 2006 met discontofactor van 6%
    kost = kost_per_kW*p_piek;
    
elseif c==3 && tijd<t1
    
    t00 = 10;
    t01 = 100;
    t02 = 200;
    t03 = 300;
    t04 = 400;
    t05 = 500;
    t06 = 600;
    t07 = t1;
    
    k00 = k1/100;
    k01 = k1/90;
    k02 = k1/80;
    k03 = k1/50;
    k04 = k1/30;
    k05 = k1/15;
    k06 = k1/5;
    k07 = k1;
    
    kost_per_kW = interp1([t0 t00 t01 t02 t03 t04 t05 t06 t07],[k0 k00 k01 k02 k03 k04 k05 k06 k07],tijd)*(1+0.06)^7; %van 1999 naar 2006 met discontofactor van 6%;
    kost = kost_per_kW*p_piek;
else
    
    kost_per_kW = interp1(t,p,tijd);
    kost = kost_per_kW*p_piek;
end



end
